package com.foxzzz.back.tracking;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Solution89 {
    public List<Integer> grayCode(int n) {
        List<Integer> list=new ArrayList<>();
        list.add(0);
        for (int i = 1; i < Math.pow(2,n); i++) {
            list.add(i^(i>>1));
        }
        return list;
    }

    public static void main(String[] args) {

        System.out.println(new Solution89().grayCode(3));

    }
}
